package br.com.sendleemail.action;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.interceptor.ServletRequestAware;
import org.apache.struts2.interceptor.ServletResponseAware;
import org.apache.struts2.interceptor.SessionAware;

import br.com.sendleemail.service.ServiceLocator;

import com.opensymphony.xwork2.ActionSupport;

public class GenericSuport extends ActionSupport implements
		ServletRequestAware, ServletResponseAware, SessionAware {

	private static final long serialVersionUID = 1L;
	protected HttpServletRequest request;
	protected HttpServletResponse response;
	protected Map<String, Object> session;
	protected ServiceLocator serviceLocator;

	public String getURI() {
		return "http://" + request.getServerName() + ":"
				+ request.getServerPort();
	}

	public String getURICompleta() {
		return "http://" + request.getServerName() + ":"
				+ request.getServerPort() + "/" + request.getServletPath();
	}

	@SuppressWarnings("unchecked")
	public void setSession(Map map) {
		this.session = map;
	}

	@SuppressWarnings("unchecked")
	public Map getSession() {
		return session;
	}

	public HttpServletRequest getServletRequest() {
		return request;
	}

	public void setServletRequest(HttpServletRequest request) {
		this.request = request;
	}

	public HttpServletResponse getServletResponse() {
		return response;
	}

	public void setServletResponse(HttpServletResponse response) {
		this.response = response;
	}

	public ServiceLocator getServiceLocator() {
		return serviceLocator;
	}

	public void setServiceLocator(ServiceLocator serviceLocator) {
		this.serviceLocator = serviceLocator;
	}

}
